package
{
	import Application.UIEditApplication.UIEditApplicationFacade;
	
	import core.Menu;
	
	import Application.MapApplication.def.Def;
	import def.XG;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.ui.ContextMenu;
	
	/**
	 * 整个PureMVC主要通过消息来传递信息，从而达到解耦的目的
	 * @author ...
	 */
	[SWF (width=800,height=600) ]
	public class UIEdit extends Sprite 
	{
		private var _menu:Menu;
		
		public function UIEdit():void 
		{	
			if(!this.stage)
			{
				init();
			}
			else
			{
				this.addEventListener(Event.ADDED_TO_STAGE,addToStage);
			}
		}
		private function init():void 
		{	
			var facade:UIEditApplicationFacade = UIEditApplicationFacade.getInstance();
			
			new XG(facade,this);
			
			facade.startup(this.stage);
			XG.menu.init(this);
		}
		
		private function addToStage(evt : Event):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, addToStage);
			
			init();
		}
		
	}
	
}